<template>
  <el-card>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>内容管理</el-breadcrumb-item>
      <el-breadcrumb-item>文章/视频列表</el-breadcrumb-item>
    </el-breadcrumb>


    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="用户管理" name="first">用户管理</el-tab-pane>
    </el-tabs>






    <!-- 按钮区 -->


    <div class="btnBox">
      <el-button @click="openAddArticleDialog('add')">添加</el-button>
      <el-button @click="deleteTopic">删除</el-button>
      <el-button @click="updateTopic(0)">停用</el-button>
      <el-button @click="updateTopic(1)">启用(黑字)</el-button>
      <!-- /按钮区 -->
      <div>
        <el-cascader v-if="shop_id == '-1'" @change="selectDepartChange" placeholder="请选择事业部" :options="departList"
          :props="{ checkStrictly: true }" clearable></el-cascader>
        <el-input v-else placeholder="请输入标题" v-model="topic_name" @clear="getList" style="width: 243px;"
          class="input-with-select" clearable>
          <el-button slot="append" @click="getList" icon="el-icon-search"></el-button>
        </el-input>
      </div>
    </div>

    <!-- 数据展示 -->
    <el-table :data="articleListData" height="70vh" @selection-change="selectionChange"
      :header-cell-style="{ background: '#409EFF', color: '#FFF' }" style="width: 100%;margin-top:10px;">
      <el-table-column type="selection" width="55" :selectable="checkSelectable"></el-table-column>
      <el-table-column prop="topic_id" width="100" label="文章编号"></el-table-column>
      <el-table-column prop="topic_name" show-overflow-tooltip label="题目"></el-table-column>
      <el-table-column label="评议状态" width="100">
        <template slot-scope="scope">{{ scope.row.author == 0 ? "否" : "是" }}</template>
      </el-table-column>
      <el-table-column prop="topic_type" label="分类"></el-table-column>
      <el-table-column prop="topic_date" label="发布时间" width="170"></el-table-column>
      <el-table-column prop="clickCount" label="点击量" width="70"></el-table-column>
      <el-table-column prop="dianzanshu" label="点赞数" width="70"></el-table-column>
      <el-table-column label="关联事业部" v-if="shop_id != 0">
        <template slot-scope="scope">
          {{ scope.row.departmenrt_id | shopNameFilter }}
        </template>
      </el-table-column>
      <el-table-column label="状态" width="80">
        <template slot-scope="scope">
          <el-tag> {{ scope.row.synopsis | synopsisFilter }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column label="是否置顶" width="80">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.zhiding == '0'">否</el-tag>
          <el-tag v-else-if="scope.row.zhiding == '1'">是</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="封面">
        <template slot-scope="prop">
          <el-image style="width: 100px; height: 100px; border-radius:8px;" fit="cover"
            :preview-src-list="[baseurl + 'topic/cover/' + prop.row.cover]"
            :src="baseurl + 'topic/cover/' + prop.row.cover"></el-image>
        </template>
      </el-table-column>
      <el-table-column label="标签">
        <template slot-scope="prop">{{ prop.row.tagIds | getTagStr }}</template>
      </el-table-column>
      <el-table-column label="操作" w>
        <template slot-scope="prop">
          <el-button v-if="prop.row.synopsis == '-2' || prop.row.synopsis == '0' || shop_id == 0"
            @click="openAddArticleDialog('edit', prop.row.topic_id, prop.row)">修改</el-button>
          <el-button v-if="prop.row.synopsis == '-2' && shop_id !== 0"
            @click="delOneHandle(prop.row.topic_id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNow"
      :page-sizes="[50, 100, 200]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
      :total="totalCount"></el-pagination>
    <!-- /数据展示 -->


    <!-- 添加/修改文章弹窗 -->
    <el-dialog :title="form.Fflag == 'add' ? '添加文章' : '修改文章'" :visible.sync="addArticleDialog" width="800px"
      :close-on-click-modal="false">
      <div>
        <el-form :inline="true" ref="formRef" :rules="rules" :model="form">
          <el-form-item label="文章题目" prop="topic_name">
            <el-input v-model="form.topic_name" style="width:200px;" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="发布时间" prop="topic_date">
            <el-date-picker v-model="form.topic_date" style="width:204px;" value-format="yyyy-MM-dd HH:mm:ss"
              type="datetime" placeholder="请选择"></el-date-picker>
          </el-form-item>
          <br />
          <el-form-item label="文章分类" prop="topic_type" v-if="shop_id == 0">
            <el-select v-model="form.topic_type" style="width:140px;" placeholder="请选择">
              <el-option label="每日知识" value="每日知识"></el-option>
              <el-option label="辟谣专栏" value="辟谣专栏"></el-option>
              <el-option label="运动健康" value="运动健康"></el-option>
              <el-option label="医生说" value="医生说"></el-option>
              <el-option label="商城运营" value="商城运营"></el-option>
              <el-option label="营销知识" value="营销知识"></el-option>
              <el-option label="健康知识" value="健康知识"></el-option>
              <el-option label="特色诊疗技术" value="特色诊疗技术"></el-option>
              <el-option label="诚赉早报" value="诚赉早报"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="是否全平台投放" prop="topic_color" v-if="shop_id == 0">
            <el-select v-model="form.topic_color" style="width:140px;" placeholder="请选择">
              <el-option label="仅限投放门店" value="1"></el-option>
              <el-option label="全平台" value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="医生" prop="doctorId" v-if="shop_id == 0">
            <el-select v-model="form.doctorId" @change="seleHandle" style="width:120px;" placeholder="请选择">
              <el-option v-for=" item  in  doctorList " :key="item.rdoctorId" :label="item.rdoctorName"
                :value="item.rdoctorId"></el-option>
            </el-select>
          </el-form-item>
          <br />
          <el-form-item label="主推门店" prop="shop_id" v-if="shop_id == 0">
            <el-select v-model="form.shop_id" style="width:300px;" placeholder="请选择">
              <el-option v-for=" item  in  shopList " :key="item.shop_id" :label="item.shop_name"
                :value="item.shop_id"></el-option>
            </el-select>
          </el-form-item>
          <br />
          <el-form-item label="评议状态" prop="author">
            <el-select v-model="form.author" style="width:100px;" placeholder="请选择">
              <el-option label="是" value="1"></el-option>
              <el-option label="否" value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="关联事业部" v-if="shop_id != 0 && form.Fflag != 'edit'">
            <el-cascader @change="addSelectDepartHandle" placeholder="请选择" :options="departList"
              clearable></el-cascader>
          </el-form-item>

          <el-form-item label="点击数" prop="clickCount">
            <el-input v-model="form.clickCount" style="width:100px;" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="点赞数" prop="dianzanshu">
            <el-input v-model="form.dianzanshu" style="width:100px;" placeholder="请输入"></el-input>
          </el-form-item>
          <br />
          <el-form-item label="上传文章图片" style="margin-top:8px;">
            <el-upload action="a" :on-change="handleChange" :on-remove="handleRemove" :file-list="fileList"
              :auto-upload="false" accept="image/*" list-type="picture">
              <el-button size="small" type="primary" style="width:90px">点击上传</el-button>
            </el-upload>
          </el-form-item>
          <el-form-item label="内容标签" prop="tagIds">
            <el-select v-model="form.tagIds" style="width:300px;" placeholder="请选择" multiple>
              <el-option v-for=" item  in  tagList " :key="item.tagId" :label="item.tagName"
                :value="item.tagId"></el-option>
            </el-select>
            <el-button style="margin-left: 16px;" @click="addPreparer">新增</el-button>
          </el-form-item>

          <el-form-item label="上传封面" style="margin-top:8px;">
            <el-upload action="a" :on-change="fmHandleChange" :on-remove="fmHandleRemove" :file-list="fileList1"
              :auto-upload="false" accept="image/*" list-type="picture">
              <el-button size="small" type="primary" style="width:90px">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeAddArticleDialog">取 消</el-button>
        <el-button type="primary" @click="submitArticle">确 定</el-button>
      </span>
    </el-dialog>
    <!-- /添加/修改文章弹窗 -->


    <!-- 添加标签 -->
    <el-dialog title="添加" :visible.sync="addTagDialogVisible" width="30%" :before-close="closeAddDialog">
      <el-button @click="addName" size="small" style="margin-bottom: 10px;"
        icon="el-icon-circle-plus-outline">添加行</el-button>
      <el-form label-width="80px">
        <el-form-item :label="'标签名' + (index + 1)" v-for="(item, index) in nameArr" :key="index">
          <el-input v-model="item.name" style="margin-bottom: 10px;"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeAddDialog">取 消</el-button>
        <el-button type="primary" @click="addSubmit">确 定</el-button>
      </div>
    </el-dialog>
  </el-card>
</template>

<script>
import {
  listTopic,
  updateTopic,
  deleteTopic,
  addTopic,
  getTopicById,
  updateTopicZhiding,
  getAllShop,
  doctorList,
  shopListTopic,
  getAllShopTopics,
  addTag, getTagList

} from "../../network/content.js";
import {
  listDepartments,
} from "../../network/depart.js";
import {
  url
} from 'network/request'
let that
export default {
  data() {
    return {
      baseurl: url,
      isClear: false,
      detail: "",
      topic_id: "",
      //文章列表
      articleListData: [],
      //分页
      totalCount: 0,
      pageNow: 1,
      pageSize: 50,
      //表格选中项
      checkList: [],
      //添加文章弹窗
      addArticleDialog: false,
      topic_name: "",
      form: {
        topic_name: "", //标题
        topic_type: "", //文章分类
        author: "", //评议状态：0否1是
        topic_date: "", //发布日期
        clickCount: "0", //点击数
        dianzanshu: "0",
        Fflag: "",
        content: "", //内容
        file: "",
        file1: "",
        zhiding: "",
        topic_color: "",
        shop_id: sessionStorage.shop_id,
        doctorId: "",
        childId: '',//产品   门店
        tagIds: [],//  内容标签 id
      },
      rules: {
        topic_name: [
          {
            required: true,
            message: "请输入文章题目",
            trigger: "blur"
          },
          {
            min: 3,
            max: 20,
            message: "长度在 3 到 20 个字符",
            trigger: "blur"
          }
        ],
        topic_type: [
          {
            required: true,
            message: "请选择文章分类",
            trigger: "change"
          }
        ],
        author: [
          {
            required: true,
            message: "请选择评议状态",
            trigger: "change"
          }
        ],
        childId: [
          {
            required: true,
            message: "请选择产品",
            trigger: "change"
          }
        ],
        topic_date: [
          {
            required: true,
            message: "请选择发布日期",
            trigger: "change"
          }
        ],
        clickCount: [
          {
            required: true,
            message: "请输入点击数",
            trigger: "blur"
          }
        ],
        dianzanshu: [
          {
            required: true,
            message: "请输入点赞数",
            trigger: "blur"
          }
        ],
        tagIds: [
          {
            required: true,
            message: "请选择标签",
            trigger: "change"
          }
        ],
        file: [
          {
            required: true,
            message: "请上传文章封面",
            trigger: "blur"
          }
        ]
      },
      fileList: [],
      fileList1: [],
      shop_id: sessionStorage.shop_id,
      shopList: [],
      doctorList: [{
        rdoctorId: '0',
        rdoctorName: "不关联医生",
      }],
      childDepartList: [],
      departList: [],//所有事业部
      departIds: '',
      nameArr: [
        { name: '' }
      ],
      addTagDialogVisible: false,
      tagList: []
    };
  },
  methods: {
    seleHandle() {
      console.log(this.form);
    },
    listDoctor() {
      doctorList({
        shopId: 0
      }).then(res => {
        if (res.flag) {
          // this.doctorList = res.data;
          var dataList = res.data;
          if (this.shop_id != 0) {
            dataList = dataList.filter(item => {
              return item.shopId == this.shop_id
            })
          }
          var dataList = res.data;
          for (var i = 0; i < dataList.length; i++) {
            this.doctorList.push(dataList[i])
          }
          console.log(this.doctorList);
        }
      });
    },
    listShops() {
      getAllShop().then(res => {
        console.log(res);
        if (res.flag) {
          this.shopList = res.data;
          this.shopList.unshift({
            shop_id: 0,
            shop_name: '全部'
          })
        }
      });
    },


    getList() {
      if (this.shop_id == -1) {
        getAllShopTopics({
          shopIds: this.departIds,
          pageNumber: this.pageNow,
          pageSize: this.pageSize,
        }).then(res => {
          if (res.flag) {
            console.log(res);
            this.totalCount = res.data.total;
            this.articleListData = res.data.list;
          }
        })
      } else if (this.shop_id == 0) {
        listTopic({
          pageSize: this.pageSize,
          pageNumber: this.pageNow,
          shop_id: this.shop_id,
          topic_name: this.topic_name,
          flag: 0
        }).then(res => {
          console.log(res);
          this.totalCount = res.data.total;
          this.articleListData = res.data.list;
        });
      } else {
        //获取文章列表
        shopListTopic({
          pageSize: this.pageSize,
          pageNumber: this.pageNow,
          shopId: this.shop_id,
          topic_name: this.topic_name,
          flag: 0
        }).then(res => {
          console.log(res);
          this.totalCount = res.data.total;
          this.articleListData = res.data.list;
        });
      }
    },
    handleSizeChange(val) {
      //pageSize发生变化时
      this.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val) {
      //pageNow发生变化时
      this.pageNow = val;
      this.getList();
    },
    updateTopic(status) {
      //修改文章状态
      if (this.checkList.length === 0)
        return this.$message.warning("请选择要操作的数据");
      let ids = "";
      for (var i = 0; i < this.checkList.length; i++) {
        ids = ids + this.checkList[i].topic_id + ",";
      }
      updateTopic({
        topic_ids: ids,
        synopsis: status,
        managerName: sessionStorage.getItem("manager_name")
      }).then(res => {
        console.log(res);
        if (res.flag) {
          this.getList();
          this.$message.success("状态更新成功");
        } else {
          this.$message.error("状态更新失败");
        }
      });
    },
    deleteTopic() {
      //删除文章
      if (this.checkList.length === 0)
        return this.$message.warning("请选择要操作的数据");
      let ids = "";
      for (var i = 0; i < this.checkList.length; i++) {
        ids = ids + this.checkList[i].topic_id + ",";
      }
      deleteTopic({
        ids: ids,
        managerName: sessionStorage.getItem("manager_name")
      }).then(res => {
        if (res.flag) {
          this.getList();
          this.$message.success("删除成功");
        } else {
          this.$message.error("删除失败");
        }
      });
    },
    // 删除单个
    delOneHandle(id) {
      this.$confirm('是否删除该文章, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteTopic({
          topic_ids: id,
          managerName: sessionStorage.getItem("manager_name")
        }).then(res => {
          if (res.flag) {
            this.getList();
            this.$message.success("删除成功");
          } else {
            this.$message.error("删除失败");
          }
        });
      }).catch(() => { });


    },
    // 指定行不可勾选
    checkSelectable(row, index) {
      if (this.shop_id != 0) {
        return row.synopsis != -2
      } else {
        return true
      }
    },
    selectionChange(val) {
      this.checkList = val;
      console.log(this.checkList);
      console.log(val);

    },
    updateTopicZhiding(status) {
      //修改文章状态
      if (this.checkList.length === 0)
        return this.$message.warning("请选择要操作的数据");
      let ids = "";
      for (var i = 0; i < this.checkList.length; i++) {
        ids = ids + this.checkList[i].topic_id + ",";
      }
      ids = ids.substring(0, ids.length - 1);
      updateTopicZhiding({
        topic_ids: ids,
        status: status,
        managerName: sessionStorage.manager_name
      }).then(res => {
        console.log(res);
        if (res.flag) {
          this.getList();
          this.$message.success("状态更新成功");
        } else {
          this.$message.error("状态更新失败");
        }
      });
    },
    openAddArticleDialog(status, topic_id, obj) {
      this.topic_id = topic_id;
      this.form = {
        topic_name: "", //标题
        topic_type: "", //文章分类
        author: "", //评议状态：0否1是
        topic_date: "", //发布日期
        clickCount: "0", //点击数
        dianzanshu: "0",
        file1: "",
        Fflag: "",
        file: "",
        topic_color: "",
        shop_id: Number(sessionStorage.shop_id),
        doctorId: '0'
      };
      //打开添加文章弹窗
      this.form.Fflag = status;
      console.log(topic_id);
      // 修改
      if (status == "edit") {

        if (this.shop_id == 0) {
          getTopicById({
            topicId: topic_id
          }).then(res => {
            if (res.flag) {
              console.log(res);
              this.form.author = res.data.author;
              this.form.clickCount = res.data.clickCount;
              this.form.dianzanshu = res.data.dianzanshu;
              this.form.synopsis = res.data.synopsis;
              this.form.topic_date = res.data.topicDate;
              this.form.topic_name = res.data.topicName;
              this.form.topic_type = res.data.topicType;
              this.form.zhiding = res.data.zhiding;
              this.form.topic_color = res.data.topicColor;
              this.form.shop_id = res.data.shopId;
              this.form.doctorId = res.data.doctorId;
              this.addArticleDialog = true;
            }
          });
        } else {
          var res = obj
          console.log(res);
          this.form.author = res.author;
          this.form.clickCount = res.clickCount;
          this.form.dianzanshu = res.dianzanshu;
          this.form.synopsis = res.synopsis;
          this.form.topic_date = res.topic_date;
          this.form.topic_name = res.topic_name;
          this.form.topic_type = res.topic_type;
          this.form.zhiding = res.zhiding;
          this.form.topic_color = res.topic_color;
          this.form.shop_id = res.shop_id;
          this.form.doctorId = '';
          this.form.childId = res.departmenrt_id;
          this.addArticleDialog = true;
        }


      } else {
        this.addArticleDialog = true;
        if (this.shopList.length == 0) {
          this.listShops();
        }
      }
    },
    closeAddArticleDialog() {
      this.$refs.formRef.resetFields();
      //关闭添加文章弹窗
      this.addArticleDialog = false;
      this.form.file = ''
      this.form.file1 = ''
    },
    handleClose() { },
    submitArticle() {
      //发布文章
      this.$refs.formRef.validate(valid => {
        if (valid) {

          console.log(this.form);
          console.log(this.form.childId);
          // if (this.shop_id != 0 && this.form.childId == undefined) {
          //   this.$message.warning('请选择关联事业部')
          //   return
          // }
          let fd = new FormData();
          if (this.form.childId == undefined) {//是否选择了事业部，没选择departmentId=0,无实际意义，传0为了后台不报错
            fd.append("departmenrtId", 0);
            fd.append("topicType", this.form.topic_type);
            fd.append("type", '0');
            fd.append("synopsis", this.shop_id == 0 ? '0' : '-2');//如果是平台，直接上传状态为未上线状态，门店上传为-2未审核状态
            fd.append("shopId", this.form.shop_id);
          } else {
            fd.append("topicType", "医生说");
            fd.append("departmenrtId", this.form.childId);
            fd.append("type", '1');
            fd.append("synopsis", "-2");
            fd.append("shopId", '-1');
          }
          fd.append("clickCount", this.form.clickCount);
          fd.append("dianzanshu", this.form.dianzanshu);
          fd.append("topicDate", this.form.topic_date);
          fd.append("flag", this.form.Fflag);
          fd.append("file", this.form.file);
          fd.append("file1", this.form.file1);
          fd.append("author", this.form.author);
          fd.append("topicName", this.form.topic_name);
          fd.append("topicColor", this.form.topic_color);
          fd.append("doctorId", this.form.doctorId);
          fd.append("managerName", sessionStorage.getItem("manager_name"));
          if (this.form.Fflag == "edit") {
            fd.append("topicId", this.topic_id);
            fd.append("zhiding", this.form.zhiding);
          }
          fd.append("tagIds", this.form.tagIds.join(','));
          addTopic(fd).then(res => {
            console.log(res);
            if (res.flag) {
              this.$message.success("发布成功");
              this.getList();
            } else {
              this.$message.error("发布失败");
            }
          });
          this.$refs.formRef.resetFields();
          this.closeAddArticleDialog();
        } else {
          return false;
        }
      });
    },
    // 文章图片
    handleChange(file, fileList) {
      console.log(file);
      this.form.file = file.raw;
    },
    handleRemove(file, fileList) {
      this.form.file = "";
    },
    // 文章封面
    fmHandleChange(file, fileList1) {
      console.log(file);
      this.form.file1 = file.raw;
    },
    fmHandleRemove(file, fileList1) {
      this.form.file1 = "";
    },
    // 获取全部事业部
    getAllDepartList() {
      listDepartments({}).then(res => {
        console.log(res);
        this.childDepartList = res.data
        res.data.forEach(ele => {
          ele.label = ele.shopName
          ele.value = ele.shopId
          if (ele.parentId == 0) {
            ele.children = []
          }
          res.data.forEach(item => {
            if (item.parentId == ele.shopId) {
              ele.children.push(item)
            }
          })
        })
        var list = res.data.filter(item => {
          return item.parentId == 0
        });
        if (this.shop_id != 0 && this.shop_id != '-1') {
          this.departList = list.filter(item => {
            return item.shopId == this.shop_id
          })
        } else {
          this.departList = list
        }
        console.log(this.departList);
      })
    },
    // 选择事业部
    selectDepartChange(val) {
      console.log(val);
      if (val.length == 1) {
        var ids = ''
        var obj = this.departList.filter(item => {
          return item.shopId == val[0]
        })
        obj[0].children.forEach(ele => {
          ids += ele.shopId + ','
        })
        console.log(obj);
        this.departIds = ids.substring(0, ids.length - 1)
      } else if (val.length == 0) {
        this.departIds = ''
      } else {
        this.departIds = val[1]
      }
      this.getList()
    },
    // 添加文章选择
    addSelectDepartHandle(val) {
      console.log(val);
      this.form.childId = val[1]
      console.log(this.form);
    },
    // 添加弹窗
    addPreparer() {
      this.addTagDialogVisible = true
    },
    addSubmit() {
      console.log(this.nameArr);
      var flag = this.nameArr.some(item => {
        return item.name == ''
      })
      if (flag) {
        return this.$message.warning('请填写完整信息')
      }
      var userNames = ''
      this.nameArr.forEach(item => {
        if (item.name !== '') {
          userNames += item.name + ','
        }
      })

      addTag({
        tagNames: userNames,
      }).then(res => {
        if (res.flag) {
          this.$message.success('添加成功')
          this.closeAddDialog()
          this.getTagList()
        }
      })
    },
    getTagList() {
      getTagList().then(res => {
        if (res.flag) {
          this.tagList = res.data
        }
      })
    },

    addName() {
      this.nameArr.push({
        name: ''
      })
    },
    closeAddDialog() {
      this.nameArr = [
        { name: '' }
      ]
      this.addTagDialogVisible = false
    },
  },
  filters: {
    synopsisFilter(val) {
      if (val == '-2') {
        return '未审核'
      } else {
        let arr = [
          "未启用",
          "启用(黑字)",
          "启用(白字)",
          "启用(无字)",
          "商学院(针对于店长)",
          "干细胞"
        ];
        let index = parseInt(val);
        return arr[index];
      }
    },
    shopNameFilter(val) {
      var name = ''
      that.childDepartList.forEach(ele => {
        if (ele.shopId == val) {
          name = ele.shopName
        }
      })
      return name
    },
    getTagStr(val) {
      var str = '';
      if (val.length != 0) {
        val.forEach(item => {
          that.tagList.forEach(ele => {
            if (ele.tagId == item) {
              str += ele.tagName + ' / '
            }
          })
        })
      }
      return str
    }
  },
  created() {
    this.getTagList()
    this.getList();
    this.listShops();
    this.listDoctor();
    if (this.shop_id != 0) {
      this.getAllDepartList()
    }
    console.log(this.baseurl);
  },
  beforeCreate() {
    that = this
  }
};
</script>

<style scoped>
.el-card {
  position: relative;
}

.btnBox {
  display: flex;
  align-items: center;
}

.btnBox>div {
  margin-left: 15px;
}
</style>
